// //reduce拷贝字符串数组
// let arr1 = ["北京", "上海", "广州"];
// let arr2 = arr1;

// arr2[1] = "shanghai";
// console.log("arr1", arr1);
// console.log("arr2", arr2);

// let arr1 = ["北京", "上海", "广州"];

// let arr2 = arr1.reduce((total, item, index, arr) => {
//   total.push(item);
//   return total;
// }, []);

// arr2[1] = "shanghai";
// console.log("arr1", arr1);
// console.log("arr2", arr2);

//reduce拷贝对象数组
let arr1 = ["北京", { address: "上海" }, "广州"];

let arr2 = arr1.reduce((total, item, index, arr) => {
  total.push(item);
  return total;
}, []);

arr2[1].address = "shanghai";
console.log("arr1", arr1);
console.log("arr2", arr2);

// concat浅拷贝   